package cc.abanlee.module.system.service.user.impl;

import cc.abanlee.module.system.dal.dataobject.user.AdminUserDO;
import cc.abanlee.module.system.service.user.AdminUserService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: create by
 * @version: v1.0
 * @description:
 * @date:2022/9/6
 */
@Service
public class AdminUserServiceImpl implements AdminUserService {

    @Resource
    private PasswordEncoder passwordEncoder;
    @Override
    public AdminUserDO getUserByUsername(String username) {
        AdminUserDO userDO=new AdminUserDO();
        userDO.setUsername("zhangsan");
        userDO.setPassword("$2a$10$QY0/hXe1ksYabJEZGvJpou2OnX1g/wZy9nwN3kMPxaGxwPi7NBCZC");
        return userDO;
    }

    @Override
    public boolean isPasswordMatch(String rawPassword, String encodedPassword) {
        return  passwordEncoder.matches(rawPassword,encodedPassword);
    }
}
